package com.unitd.frame.mybatis.plugin.shard;

import com.unitd.frame.mybatis.interceptor.IInterceptorHandler;
import com.unitd.frame.mybatis.plugin.MybatisPluginInterceptor;
import org.apache.ibatis.plugin.Invocation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;

 /**
 * @desc 分表自动路由处理
 * @filename DatabaseRouteHandler.java
 * @copyright www.unitd.com
 * @author Hudan
 * @version 1.0
 * @date 2017/3/5
 */
public class TableRouteHandler implements IInterceptorHandler, InitializingBean {

	protected static final Logger logger = LoggerFactory.getLogger(TableRouteHandler.class);

	/**
	 * @param context Mybatis上下文
	 * @desc 进入拦截器, 开始进行拦截处理
	 */
	@Override
	public void start(MybatisPluginInterceptor context) {

	}

	/**
	 * @return int
	 * @desc 设置不同拦截器的加载顺序
	 */
	@Override
	public int interceptorOrder() {
		return 0;
	}

	/**
	 * @param invocation 调用器
	 * @desc 拦截器开启调用拦截处理
	 */
	@Override
	public Object onInterceptor(Invocation invocation) throws Throwable {
		return null;
	}

	/**
	 * @param invocation 调用器
	 * @param result     结果对象
	 * @desc 结束拦截调用处理
	 */
	@Override
	public void onFinished(Invocation invocation, Object result) {

	}

	/**
	 * @desc 关闭拦截器, 退出拦截
	 */
	@Override
	public void close() {

	}

	@Override
	public void afterPropertiesSet() throws Exception {

	}
}